<?php

namespace app\zmt\model;

use think\Model;

class GoodsModel extends Model
{
    protected $name = 'goods';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'datetime';

    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';

    public function cate()
    {
        return $this->hasOne(GoodsCateModel::class, 'goods_id', 'id');
    }

    public function getImagesAttr($value)
    {
        return explode(',', $value);
    }
}
